package mark.tom.detector;

import android.annotation.SuppressLint;
import android.util.Log;

import mark.tom.detector.template.Logger;


class AndroidLogger implements Logger {

    private final static String TAG = "AndroidLogger";

    private boolean onOff = true;

    @Override
    public void onOff(boolean on) {
        this.onOff = on;
    }

    @SuppressLint("LogNotTimber")
    @Override
    public void log(String message, int level) {
        if (!onOff) {
            return;
        }
        switch (level) {
            case Log.VERBOSE : {
                Log.v(TAG, message);
                break;
            }
            case Log.DEBUG : {
                Log.d(TAG, message);
                break;
            }
            case Log.INFO : {
                Log.i(TAG, message);
                break;
            }
            case Log.WARN : {
                Log.w(TAG, message);
                break;
            }
            case Log.ERROR : {
                Log.e(TAG, message);
                break;
            }
            default : {
                // ignore
            }
        }
    }
}
